// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "LyraGameplayAbility.h"

#include "LyraGameplayAbility_Death.generated.h"

class UObject;
struct FFrame;
struct FGameplayAbilityActorInfo;
struct FGameplayEventData;

/**
 * ULyraGameplayAbility_Death
 *
 *	用于处理死亡的Gameplay Ability。
 *	该能力通过"GameplayEvent.Death"能力触发标签自动激活。
 */
UCLASS(Abstract)
class ULyraGameplayAbility_Death : public ULyraGameplayAbility
{
	GENERATED_BODY()

public:

	ULyraGameplayAbility_Death(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

protected:

	/**
	 * 激活能力
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 能力执行者信息
	 * @param ActivationInfo 能力激活信息
	 * @param TriggerEventData 触发事件数据
	 */
	virtual void ActivateAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const FGameplayEventData* TriggerEventData) override;
	
	/**
	 * 结束能力
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 能力执行者信息
	 * @param ActivationInfo 能力激活信息
	 * @param bReplicateEndAbility 是否复制结束能力
	 * @param bWasCancelled 是否被取消
	 */
	virtual void EndAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateEndAbility, bool bWasCancelled) override;

	// 开始死亡序列。
	UFUNCTION(BlueprintCallable, Category = "Lyra|Ability")
	void StartDeath();

	// 完成死亡序列。
	UFUNCTION(BlueprintCallable, Category = "Lyra|Ability")
	void FinishDeath();

protected:

	// 如果启用，能力将自动调用StartDeath。如果死亡已开始，当能力结束时总是会调用FinishDeath。
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Lyra|Death")
	bool bAutoStartDeath; // 自动开始死亡标志
};